package pers.wensheng.patterns.behavioral_pattern.observer_pattern.jdk_impl.entity;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.util.Observable;

/**
 * 小偷类，被观察者
 */
@Getter
@Setter
@AllArgsConstructor
public class Thief extends Observable{
    private String name;


    /**
     * 偷东西
     */
    public void steal(){
        System.out.println("小偷：我偷东西了，来捉我");
        setChanged();
        notifyObservers();
    }
}
